//
//  AVOSManger.h
//  FunnyVideo
//
//  Created by 李鑫 on 15/9/11.
//  Copyright © 2015年 NewEggTech. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AVOSErrorManger.h"
#import "AVOSBase.h"
#import "AVObject+AVObject_Category.h"


typedef void (^VideoListUpdateSucc)(NSArray *v_urls,NSArray *v_names,NSArray *v_ctimes,NSArray *v_descs,NSArray *v_ids, NSUInteger videoCount);

typedef void (^VideoAVOSListUpdateSucc)(NSArray *v_urls,NSArray *v_names,NSArray *pub_user,NSArray *v_ctimes,NSArray *v_descs, NSArray *likes,NSArray *indexs,NSArray *v_ids,NSArray *v_cate,NSArray *videoCmtCount, NSUInteger videoCount);

@interface AVOSManger : AVOSBase



- (void)resetPasswordByVerifyCode:(NSString *)vfCode newPsw:(NSString *)newPsw completion:(void(^)(BOOL isSucc,NSError *error))completion;

- (void)sendPswChangedAction:(NSString *)oP andNewPsw:(NSString *)newPsw completion:(void(^)(bool isSucc,NSString *info))completion;

/**
 *  Video Type Get
 *
 *  @return AVOSVideoType
 */
- (AVOSVideoType)videoType;
/**
 *  store the video type in user defaults
 *
 *  @param str_type string video type
 *
 *  @return if sync action is succ
 */
- (BOOL)syncVideoType:(NSString *)str_type;
/**
 *  Update Video Infos From AVOS Server
 *
 *  @param updateCompletion 更新完成回调
 */
- (void)updateVideoListsFromAVOSLimition:(NSUInteger)limition type:(AVOSVideoType)v_type updateCompletion:(VideoAVOSListUpdateSucc)completion;
/**
 *  Update Video Infos From Local cached
 *
 *  @param lim        limition of data every time
 *  @param path       path of data file
 *  @param completion completion blocks
 */
- (void)updateLocalVideoList:(NSUInteger)lim localPlistPath:(NSString *)path completion:(VideoAVOSListUpdateSucc)completion;
/**
 *  Update Video Infos From TXY Server
 *
 *  @param videoListCount   The limition of Video Count
 *  @param updateCompletion Update Completion Block
 */
- (void)updateVideoList:(NSUInteger)videoListCount updateCompletion:(VideoListUpdateSucc)updateCompletion;
/**
 *  获取评论内容
 *
 *  @param videoId video id of avos object
 *  @param block   completion block
 */
- (void)getCommentWithVideoId:(NSString *)videoId completion:(void (^)(NSUInteger httpcode,NSDictionary *respDic))block;
/**
 *  提交评论信息
 *
 *  @param cmt       视频的评论内容
 *  @param videoId   video id of avos object
 *  @param u_session the session of users(you must set the user session to complete the comment sent)
 *  @param block     completion block
 */
- (void)sendComment:(NSString *)cmt videoId:(NSString *)videoId userId:(NSString *)userId userSession:(NSString *)u_session completion:(void (^)(BOOL,NSString *))block;

- (void )queryVideoIdByObjectId:(NSString *)objId completion:(void(^)(NSString *))completion;
/**
 *  query the avos video id by the sha on qcloud video server
 *
 *  @param sha        the sha of video file on the qcloud server
 *  @param completion completion block
 */
- (void )queryVideoIdBySHA:(NSString *)sha completion:(void(^)(NSString *))completion;

/**
 *  Get the Supported Number of the special video and judge the user if like this video
 *
 *  @param v_id  the id of the video
 *  @param block block
 */
- (void)getSupportAtVideoId:(NSString *)v_id completion:(void(^)(NSUInteger sptNum))block isLiked:(void(^)(BOOL isLiked,BOOL canLike))l_block;
/**
 *  Send the Support action for the sepcial video id
 *
 *  @param v_id  the video id of the special video
 *  @param block the completion block
 */
- (void)supportVideoId:(NSString *)v_id completion:(void(^)(NSUInteger sptNum,BOOL succ))block;

/**
 *  Send the cancle video id of the special video
 *
 *  @param v_id  the v_id of the special video
 *  @param block the completion block
 */
- (void)cancleVideoId:(NSString *)v_id completion:(void(^)(NSUInteger sptNum,BOOL succ))block;
/**
 *  Get the Supported Number of the special video and judge the user if like this video
 *
 *  @param v_id  the id of the video
 *  @param block block
 */
- (void)getSupportAtCmtId:(NSString *)v_id completion:(void(^)(NSUInteger sptNum))block isLiked:(void(^)(BOOL isLiked,BOOL canLike))l_block;
/**
 *  Send the Support action for the sepcial video id
 *
 *  @param v_id  the video id of the special video
 *  @param block the completion block
 */
- (void)supportCmtId:(NSString *)v_id completion:(void(^)(NSUInteger sptNum,BOOL succ))block;

/**
 *  Send the cancle video id of the special video
 *
 *  @param v_id  the v_id of the special video
 *  @param block the completion block
 */
- (void)cancleCmtId:(NSString *)v_id completion:(void(^)(NSUInteger sptNum,BOOL succ))block;

- (void)submitVideoURL:(NSString *)v_url;

+ (void)valueForAVOSStaticType:(AVOSDefautsType)type block:(void(^)(NSString *resp))block;
/**
 *  singleton fetch method
 *
 *  @return AVOSManger Instance
 */
+ (AVOSManger *)sharedManger;

@end
